import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Administrator
 * Date: 2023-04-26
 * Time: 16:10
 */
public class Payment {
    public static void pay(String product) throws ArrayIndexOutOfBoundsException{
        double price = 18.5;
        String[] array = product.split(" ");
        int count = Integer.parseInt(array[2]);
        double money = count * price;
        System.out.println("需支付"+money+"元");
    }

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        System.out.println("请输入商品名和件数");
        String product = scan.nextLine();
        try {
            pay(product);
        }catch (ArrayIndexOutOfBoundsException e){
            System.out.println("异常信息：数组下标越界");
        }finally {
            scan.close();
        }
    }
}
